Skip to content

fix(signals): count only flag checks as stale-flag call sites - #131380

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/ff-scout-call-site-gate
Nov 7, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
posthog/ff-scout-call-site-gate

Conversation

@posthog

@posthog posthog Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Problem

The feature-flags scout can mark a stale-flag cleanup immediately_actionable from any gh search code match for the key. A declaration (an enum entry or a JSON list of flag keys) or an identifier that shares the key's string passes that check. The result is a draft PR with nothing to remove, or one that removes a live setting or route.

Why: a per-team cleanup scout ran into both failure modes and fixed them, and the canonical scout's call-site check has the same gap.

Changes

  • A match counts as a call site only when it evaluates the flag or declares a gate in a flag field. Declarations are followed to their evaluations, and identifier-only matches never count.
  • Searches a cloned checkout when the run has one. An empty code-search result is weak evidence.
  • Mechanical: the stale-flag lane moves to references/stale-flags.md, cutting the body from about 56k to 40k characters. The fallback text drops a rollout-flag name.

How did you test this code?

Test rationale: prompt-only change, no code paths touched. No test reads scout prose. test_scout_precheck.py covers only the unchanged frontmatter precheck.

  • Checked the quoted-key rg pattern: it matches 'beta' and `beta`, and skips "beta-2".
  • Not run: lazy-seed sync, a scout run, or a private trial against this body.

Release status

  • No feature flag controls this change

Docs update

  • None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted). The directing person still needs to self-assign; the agent's GitHub identity could not resolve them.

Agent: Claude Code (PostHog Desktop), Opus 5.5

Skills: authoring-scouts

  • No duplicate: open-PR search for this scout found nothing related.
  • Public artifact: no project data, counts, or customer material included.
More context for AI agents
  • Decisions: kept the lane summary and three invariants in the body so a run that skips the reference still cannot bundle or over-promote.
  • Read closely: references/stale-flags.md "Confirm a call site" and the effectively_full_rollout sentence under "When no code is left".
  • Follow-ups: a private scout trial comparing this body against the previous one.

Created with PostHog Desktop from an inbox report

🤖 Generated with Claude Code

The feature-flags scout confirmed a stale flag's call site with a raw `gh search code` match, so a declaration (an enum or a JSON list of flag keys) or an identifier that shares the key could gate an immediately-actionable cleanup.

A match now counts only when it evaluates the flag or declares a gate in a flag field. Declarations are followed to their evaluations, and identifier-only matches never count. The run searches a cloned checkout when one is configured and treats an empty code-search result as weak evidence.

The stale-flag lane moves into references/stale-flags.md, read on demand, which takes the body from about 56k to 40k characters. The rollout-flag name in the fallback text is dropped; the existing unfiltered health-issue probe already tells the run whether the check reaches the project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: cd6234bd-edc0-481e-a4b4-3fa9c66ba129
@posthog posthog Bot added the self-driving label Nov 7, 2026
@posthog
posthog Bot marked this pull request as ready for review November 7, 2026 13:22
@trunk-io

trunk-io Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@stamphog
stamphog Bot requested a review from a team November 7, 2026 13:22
@posthog
posthog Bot requested a review from andrewm4894 November 7, 2026 13:22
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

@andrewm4894

Copy link
Copy Markdown
Member

/trunk merge

@trunk-io
trunk-io Bot merged commit e534284 into master Nov 7, 2026
265 of 303 checks passed
@trunk-io
trunk-io Bot deleted the posthog/ff-scout-call-site-gate branch November 7, 2026 13:49
@deployment-status-posthog

deployment-status-posthog Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-11-07 14:14 UTC Run
prod-us ✅ Deployed 2026-11-07 14:27 UTC Run
prod-eu ✅ Deployed 2026-11-07 14:27 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant